home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 4 / Windows 6-Pak (InfoMagic) (Disc 4) (1999).ISO / Text-Chat-Scripts / pp-320m.exe / pp300 / a-confg1.mrc next >
Text File  |  1998-08-29  |  30KB  |  756 lines

  1. ; -----------------------------------------------------
  2. ; Peace and Protection (by misspai)
  3. ; -----------------------------------------------------
  4. ; Configurations (part 1)
  5. ; -----------------------------------------------------
  6. ; Protection settings editor
  7. ; -----------------------------------------------------
  8. protedit {
  9.   window -c @Protection
  10.   if (($1 != $null) && ($_not($_ischan($1)))) _error You can only edit protection settings for channels (or global if you don't specify a channel)
  11.   window -lar $_tabscale(21,46,52,58,64,70,76,82,88,94,100) @Protection 0 0 $window(-3).w $window(-3).h @Protection %font.basic
  12.   if ($1 == $null) {
  13.     titlebar @Protection settings (global $+ $chr(160) $+ / $+ $chr(160) $+ default)
  14.     aline @Protection - Double-click to edit setting or option; Right-click for options -
  15.   }
  16.   else {
  17.     titlebar @Protection settings for $1
  18.     aline @Protection - Double-click to edit setting or option; Right-click for options - %col.addr $+ [default] means global setting for all channels
  19.   }
  20.   set %_prot.ini $_ppdir $+ protedit.ini
  21.   aline @Protection $chr(160)
  22.   aline @Protection  Protection      Activates on      Action sequence 
  23.   set %_prot.bar 100
  24.   set %.pe.max $readini -n %_prot.ini protis num
  25.   set %.pe.num 1
  26.   :loop1
  27.   _pdispl %.pe.num $1
  28.   if ($_vi(.pe.num) <= %.pe.max) goto loop1
  29.   window -b @Protection
  30. }
  31. _pdispl {
  32.   set %.pe.is $readini -n %_prot.ini protis $1
  33.   if (%.pe.is == -) { aline @Protection $chr(160) | return }
  34.   if (%.pe.is == *) { aline @Protection  Feature      Setting  | set %_prot.bar $1 | return }
  35.   set %.pe.post $gettok(%.pe.is,1,32)
  36.   set %.pe.is $gettok(%.pe.is,2-,32)
  37.   set %.pe.pre $readini -n %_prot.ini protset %.pe.post
  38.   set %.pe.pren $_numtok(32,%.pe.pre)
  39.   set %.pe.prenc 1
  40.   unset %.+pe.def
  41.   :loop2
  42.   set %.pe.get $gettok(%.pe.pre,%.pe.prenc,32) $+ %.pe.post
  43.   if ($2 == $null) set %.pe. [ $+ [ %.pe.prenc ] ] % [ $+ [ %.pe.get ] ]
  44.   else {
  45.     set %.pe.get2 %.pe.get $+ . $+ $2
  46.     set %.pe.got % [ $+ [ %.pe.get2 ] ]
  47.     if (%.pe.got == $null) {
  48.       set %.+pe.def $true
  49.       set %.pe. [ $+ [ %.pe.prenc ] ] % [ $+ [ %.pe.get ] ]
  50.     }
  51.     else set %.pe. [ $+ [ %.pe.prenc ] ] %.pe.got
  52.   }
  53.   if ($_vi(.pe.prenc) <= %.pe.pren) goto loop2
  54.   if ((%.pe.1 == $true) || (%.pe.1 == on)) set %.pe.text %col.info1 $+ [enabled]
  55.   elseif ((%.pe.1 == 0) || (%.pe.1 == $null) || (%.pe.1 == $false) || (%.pe.1 == off)) set %.pe.text %col.att $+ [disabled]
  56.   elseif (%.+pe.def) set %.pe.text $readini -n %_prot.ini protmin %.pe.post
  57.   else set %.pe.text $readini -n %_prot.ini protact %.pe.post
  58.   if (%.+pe.def) set %.pe.text %col.addr $+ [default]á %.pe.text
  59.   :loop3
  60.   set %.pe.rep1 & $+ %.pe.pren $+ &
  61.   set %.pe.repw %col.target $+ %.pe. [ $+ [ %.pe.pren ] ] $+ 
  62.   set %.pe.text $replace(%.pe.text,%.pe.rep1,%.pe.repw)
  63.   if ($_vd(.pe.pren) > 0) goto loop3
  64.   unset %.+pe.def
  65.   set %.pe.get action1. $+ %.pe.post
  66.   if ($2 == $null) set %.pe.act % [ $+ [ %.pe.get ] ]
  67.   else {
  68.     set %.pe.get22 %.pe.get $+ . $+ $2
  69.     set %.pe.act % [ $+ [ %.pe.get22 ] ]
  70.     if (%.pe.act == $null) {
  71.       set %.+pe.def $true
  72.       set %.pe.act % [ $+ [ %.pe.get ] ]
  73.     }
  74.   }
  75.   if (%.pe.pad1 > 18) unset %.pe.act
  76.   else {
  77.     set %.pe.act %col.target $+ %.pe.act $+ 
  78.     set %.pe.actn 2
  79.     :loop4
  80.     set %.pe.get action $+ %.pe.actn $+ . $+ %.pe.post
  81.     if ($2 != $null) if (%.+pe.def == $false) set %.pe.get %.pe.get $+ . $+ $2
  82.     set %.pe.got % [ $+ [ %.pe.get ] ]
  83.     if (%.pe.got != $null) {
  84.       set %.pe.act %.pe.act ,     $+ %col.target $+ %.pe.got $+ 
  85.       inc %.pe.actn
  86.       goto loop4
  87.     }
  88.     if (%.+pe.def) set %.pe.act %col.addr $+ [default]     $+ %.pe.act
  89.   }
  90.   if ($1 > %_prot.bar) rline @Protection $calc($1 + 3) %.pe.is $+      $+ %.pe.text
  91.   else rline @Protection $calc($1 + 3) %.pe.is $+      $+ %.pe.text $+      $+ %.pe.act
  92. }
  93. _peditl {
  94.   if ($1 < 4) return
  95.   set %.line $calc($1 - 3)
  96.   set %_prot.line $1
  97.   set %.is $readini -n %_prot.ini protis %.line
  98.   if (%.is isin -*) return
  99.   set %_prot.post $gettok(%.is,1,32)
  100.   set %_prot.pre $readini -n %_prot.ini protset %_prot.post
  101.   set %.chan $gettok($window(@Protection).titlebar,3,32)
  102.   if (%.chan != $null) set %.chan . $+ %.chan
  103.   set %_prot.chan %.chan
  104.   if ($1 > $_i(%_prot.bar)) {
  105.     set %.var %_prot.pre $+ %_prot.post
  106.     set %.name $readini -n %_prot.ini protset %.var
  107.     set %.bit $left(%.name,1)
  108.     set %.var %.var $+ %.chan
  109.     set %.value % [ $+ [ %.var ] ]
  110.     if ($2 == ) {
  111.       if (%.chan == $null) set % [ $+ [ %.var ] ] $readini -n %_prot.ini default %.var
  112.       else set % [ $+ [ %.var ] ]
  113.     }
  114.     elseif (%.bit == N) {
  115.       if (($2 == $null) || ($2 !isnum)) { set %_arhelp _peditl $1 |  _pentry _arhelp $+ $_s2p(%.value) $_rchop(1,%.name) }
  116.       set % [ $+ [ %.var ] ] $2
  117.     }
  118.     elseif (%.bit == S) {
  119.       if ($2 == $null) {
  120.         window -c @WhoisOnJoin
  121.         window -l @WhoisOnJoin $_winpos(35%,35%,28%,28%) /_wsetclk @WhoisOnJoin %font.basic
  122.         aline @WhoisOnJoin - Double-click on when you want to whois users -
  123.         aline @WhoisOnJoin $chr(160)
  124.         aline @WhoisOnJoin Don't whois users automatically
  125.         aline @WhoisOnJoin Whois users when they join, if you are opped
  126.         aline @WhoisOnJoin Always whois users when they join channel
  127.         set %_prot.whois $1
  128.         halt
  129.       }
  130.       if ($2 == $chr(160)) set % [ $+ [ %.var ] ] off
  131.       else set % [ $+ [ %.var ] ] $2
  132.     }
  133.     elseif ($2 == $chr(160)) set % [ $+ [ %.var ] ] $false
  134.     else set % [ $+ [ %.var ] ] $_not(%.value)
  135.     if (%_prot.chan == $null) _pdispl %.line
  136.     else _pdispl %.line $_rchop(1,%_prot.chan)
  137.     return
  138.   }
  139.   elseif ($2 == ) {
  140.     window -c @Setting
  141.     set %_prot.ln6 A
  142.     _psetclk A
  143.     return
  144.   }
  145.   elseif ($2 == $chr(160)) {
  146.     window -c @Setting
  147.     set %_prot.ln5 B
  148.     _psetclk B
  149.     return
  150.   }
  151.   set %.is $gettok(%.is,2-,32)
  152.   window -c @Setting
  153.   window -l $_tabscale(7) @Setting $_winpos(20%,20%,7%,7%) @Setting %font.basic
  154.   titlebar @Setting - %.is
  155.   aline @Setting %col.dark $+ Protection triggers- (double-click to edit)
  156.   set %.pren $_numtok(32,%_prot.pre)
  157.   set %.prec 1
  158.   :loop1
  159.   set %.var $gettok(%_prot.pre,%.prec,32) $+ %_prot.post
  160.   set %.name $readini -n %_prot.ini protset %.var
  161.   set %.bit $left(%.name,1)
  162.   set %.var %.var $+ %.chan
  163.   set %.value % [ $+ [ %.var ] ]
  164.   if (%.value == $null) {
  165.     if (%.chan == $null) set %.value %col.att $+ [disabled]
  166.     else set %.value %col.addr $+ (global default)
  167.   }
  168.   elseif (%.value == $true) set %.value %col.info1 $+ [enabled]
  169.   elseif ((%.value == $false) || (%.value == 0)) set %.value %col.att $+ [disabled]
  170.   else set %.value %col.target $+ %.value
  171.   aline @Setting $_rchop(1,%.name) - %.value
  172.   if ($_vi(.prec) <= %.pren) goto loop1
  173.   set %_prot.ln1 $line(@Setting,0)
  174.   aline @Setting $chr(160)
  175.   aline @Setting %col.dark $+ Action sequence- (double-click to edit, right-click to delete an action)
  176.   set %.var action1. $+ %_prot.post $+ %.chan
  177.   if (% [ $+ [ %.var ] ] == $null) {
  178.     aline @Setting ò %col.addr $+ (global default)
  179.     set %_prot.ln2 $line(@Setting,0)
  180.     set %_prot.ln3 %_prot.ln2
  181.     set %_prot.ln4 %_prot.ln2
  182.     set %_prot.add 1
  183.   }
  184.   else {
  185.     set %_prot.ln2 $_i($line(@Setting,0))
  186.     set %.prec 1
  187.     :loop2
  188.     set %.var action $+ %.prec $+ . $+ %_prot.post $+ %.chan
  189.     set %.act % [ $+ [ %.var ] ]
  190.     if (%.act != $null) {
  191.       set %.km $readini -n %_prot.ini msg %_prot.post
  192.       if (%.prec > 1) set %.km %.km $+ %.prec
  193.       set %.msg $_ppcfg(Kicks,%.km)
  194.       if (%.msg == $null) set %.msg $_ppdef(Kicks,%.km)
  195.       aline @Setting ò $_s2f(%.act) $+     " $+ %.msg $+ "
  196.       inc %.prec
  197.       goto loop2
  198.     }
  199.     set %_prot.ln3 $line(@Setting,0)
  200.     aline @Setting ò %col.dark $+ (add an action)
  201.     set %_prot.ln4 $line(@Setting,0)
  202.     set %_prot.add %.prec
  203.   }
  204.   aline @Setting $chr(160)
  205.   aline @Setting %col.dark $+ - Double-click here to disable this protection -
  206.   set %_prot.ln5 $line(@Setting,0)
  207.   if (%.chan == $null) aline @Setting %col.dark $+ - Double-click here for default settings -
  208.   else aline @Setting %col.dark $+ - Double-click here for global default settings -
  209.   set %_prot.ln6 $line(@Setting,0)
  210.   aline @Setting $chr(160)
  211.   aline @Setting &codes& supported by these messages- (see help for details)
  212.   aline %col.base @Setting - $readini -n %_prot.ini c0 all
  213.   aline %col.base @Setting - $readini -n %_prot.ini c1 %_prot.post
  214.   aline %col.base @Setting - $readini -n %_prot.ini c2 %_prot.post
  215. }
  216. _psetclk {
  217.   if (($1 >= 2) && ($1 <= %_prot.ln1)) {
  218.     set %.var $gettok(%_prot.pre,$_j($1),32) $+ %_prot.post
  219.     set %.name $readini -n %_prot.ini protset %.var
  220.     set %.bit $left(%.name,1)
  221.     set %.var %.var $+ %_prot.chan
  222.     set %.value % [ $+ [ %.var ] ]
  223.     if (%.bit == O) set % [ $+ [ %.var ] ] $_not(%.value)
  224.     elseif (%.bit == N) {
  225.       if (($2 == $null) || ($2 !isnum)) { set %_arhelp _psetclk $1 | _pentry _arhelp $+ $_s2p(%.value) $_rchop(1,%.name) }
  226.       set % [ $+ [ %.var ] ] $2
  227.     }
  228.     elseif (%.bit == S) {
  229.       if ($2 == $null) {
  230.         window -c @Revolve
  231.         window -l @Revolve $_winpos(28%,28%,26%,26%) @Revolve %font.basic
  232.         aline @Revolve - Double-click on what you want to be counted as revolves -
  233.         aline @Revolve $chr(160)
  234.         aline @Revolve part
  235.         aline @Revolve join
  236.         aline @Revolve part/join
  237.         aline @Revolve kick
  238.         aline @Revolve kick/part
  239.         aline @Revolve kick/join
  240.         aline @Revolve kick/part/join
  241.         halt
  242.       }
  243.       set % [ $+ [ %.var ] ] $2
  244.     }
  245.     else {
  246.       if ($2 == $null) {
  247.         window -c @ListSetting
  248.         window -l @ListSetting $_winpos(19%,19%,26%,26%) @ListSetting %font.basic
  249.         aline @ListSetting - Double-click to modify an entry, right-click to delete an entry -
  250.         aline @ListSetting $chr(160)
  251.         set %_prot.value %.value
  252.         set %.nm $_numtok(32,%.value)
  253.         if (%.nm > 0) {
  254.           set %.cr 1
  255.           :loopie
  256.           aline @ListSetting $gettok(%.value,%.cr,32)
  257.           if ($_vi(.cr) <= %.nm) goto loopie
  258.         }
  259.         aline @ListSetting (addánewáentry)
  260.         halt
  261.       }
  262.       set % [ $+ [ %.var ] ] $3-
  263.     }
  264.     set %.value % [ $+ [ %.var ] ]
  265.     if (%.value == $null) {
  266.       if (%.chan == $null) set %.value %col.att $+ [disabled]
  267.       else set %.value %col.addr $+ (global default)
  268.     }
  269.     elseif (%.value == $true) set %.value %col.info1 $+ [enabled]
  270.     elseif ((%.value == $false) || (%.value == 0)) set %.value %col.att $+ [disabled]
  271.     else set %.value %col.target $+ %.value
  272.     rline @Setting $1 $_rchop(1,%.name) - %.value
  273.   }
  274.   elseif (($1 >= %_prot.ln2) && ($1 <= %_prot.ln4)) {
  275.     if ($2 == $null) {
  276.       window -c @Actions
  277.       window -l @Actions $_winpos(16%,16%,35%,35%) @Actions %font.basic
  278.       aline @Actions - Double-click to select an action -
  279.       aline @Actions %=
  280.       aline @Actions warn (warning via notice)
  281.       aline @Actions kick (kick)
  282.       aline @Actions tempban (20 second ban)
  283.       aline @Actions kb (kickban)
  284.       aline @Actions kb0 (kickban ip)
  285.       aline @Actions kb2 (kickban domain)
  286.       aline @Actions cb (cloneban)
  287.       aline @Actions cb0 (cloneban ip)
  288.       aline @Actions cb2 (cloneban domain)
  289.       aline @Actions deop (deop)
  290.       aline @Actions fk (filterkick clones)
  291.       aline @Actions fknop (filterkick non-opped clones)
  292.       aline @Actions (custom)
  293.       if ($1 < %_prot.ln4) {
  294.         set %.old $strip($gettok($line(@Setting,$1),2,32))
  295.         set %.old $findtok(warn.kick.tempban.kb.kb0.kb2.cb.cb0.cb2.deop.fk.fknop,%.old,46)
  296.         if (%.old < 1) set %.old 15
  297.         else inc %.old 2
  298.         sline @Actions %.old
  299.       }
  300.       set %_prot.ln $1
  301.       halt
  302.     }
  303.     if (($2 != $chr(160)) && ($3 == $null)) {
  304.       set %_prot.km $readini -n %_prot.ini msg %_prot.post
  305.       set %.kmn $calc($1 - %_prot.ln2 + 1)
  306.       if (%.kmn > 1) set %_prot.km %_prot.km $+ %.kmn
  307.       set %.msg $_ppcfg(Kicks,%_prot.km)
  308.       if (%.msg == $null) set %.msg $_ppdef(Kicks,%_prot.km)
  309.       set %_arhelp _psetclk $1 $2
  310.       _pentry _arhelp $+ $_s2p(%.msg) Message to go with action?(note that action messages are not channel-specific)
  311.     }
  312.     if ($1 == %_prot.ln4) {
  313.       set %.var action $+ %_prot.add $+ . $+ %_prot.post $+ %_prot.chan
  314.       set % [ $+ [ %.var ] ] $_f2s($2)
  315.       _writecfg Kicks %_prot.km $3-
  316.       rline @Setting %_prot.ln4 ò %col.dark $+ (add an action)
  317.       iline @Setting %_prot.ln4 ò $2 $+  " $+ $3- $+ "
  318.       inc %_prot.add | inc %_prot.ln6 | inc %_prot.ln5 | inc %_prot.ln4 | inc %_prot.ln3
  319.     }
  320.     else {
  321.       set %.num $calc($1 - %_prot.ln2 + 1)
  322.       if ($2 == $chr(160)) {
  323.         dline @Setting $1
  324.         set %.num2 $_i(%.num)
  325.         set %.km $readini -n %_prot.ini msg %_prot.post
  326.         :loopde
  327.         set %.var action $+ %.num $+ . $+ %_prot.post $+ %_prot.chan
  328.         if (%.num > 1) set %.kmn %.km $+ %.num
  329.         else set %.kmn %.km
  330.         if (%.num2 == %_prot.add) { set % [ $+ [ %.var ] ] | _remcfg Kicks %.kmn }
  331.         else {
  332.           set %.var2 action $+ %.num2 $+ . $+ %_prot.post $+ %_prot.chan
  333.           set %.km2 %.km $+ %.num2
  334.           set % [ $+ [ %.var ] ] % [ $+ [ %.var2 ] ]
  335.           _writecfg Kicks %.kmn $_ppcfg(Kicks,%.km2)
  336.           inc %.num | inc %.num2 | goto loopde
  337.         }
  338.         dec %_prot.add | dec %_prot.ln6 | dec %_prot.ln5 | dec %_prot.ln4 | dec %_prot.ln3
  339.       }
  340.       else {
  341.         set %.var action $+ %.num $+ . $+ %_prot.post $+ %_prot.chan
  342.         set % [ $+ [ %.var ] ] $_f2s($2)
  343.         _writecfg Kicks %_prot.km $3-
  344.         rline @Setting $1 ò $2 $+  " $+ $3- $+ "
  345.       }
  346.     }
  347.   }
  348.   elseif ($1 == %_prot.ln5) {
  349.     set %.var $gettok(%_prot.pre,1,32) $+ %_prot.post
  350.     set %.name $readini -n %_prot.ini protset %.var
  351.     set %.bit $left(%.name,1)
  352.     set %.var %.var $+ %_prot.chan
  353. if (%.bit == N) {
  354. set % [ $+ [ %.var ] ] 0
  355. if (%.var == max.clone) set %warn.clone 0
  356. }
  357.     elseif (%.bit == L) set % [ $+ [ %.var ] ] $null
  358.     else set % [ $+ [ %.var ] ] $false
  359.     if ($_isopen(@Setting)) rline @Setting 2 $_rchop(1,%.name) - %col.att $+ [disabled]
  360.   }
  361.   elseif ($1 == %_prot.ln6) {
  362.     if (%_prot.chan == $null) {
  363.       set %.nm $_numtok(32,%_prot.pre)
  364.       :Crash
  365.       set %.var $gettok(%_prot.pre,%.nm,32) $+ %_prot.post
  366.       set % [ $+ [ %.var ] ] $readini -n %_prot.ini default %.var
  367.       if ($_vd(.nm) > 0) goto crash
  368.       set %.var action*. $+ %_prot.post
  369.       [ unset % $+ [ %.var ] ]
  370.       set %.acts $readini -n %_prot.ini default %.var
  371.       set %.nm $_numtok(32,%.acts)
  372.       set %.km $readini -n %_prot.ini msg %_prot.post
  373.       :Test
  374.       set %.var action $+ %.nm $+ . $+ %_prot.post
  375.       set % [ $+ [ %.var ] ] $gettok(%.acts,%.nm,32)
  376.       if (%.nm > 1) set %.kmn %.km $+ %.nm
  377.       else set %.kmn %.km
  378.       _remcfg Kicks %.kmn
  379.       if ($_vd(.nm) > 0) goto test
  380.       if ($_isopen(@Setting)) _peditl %_prot.line
  381.     }
  382.     else {
  383.       set %.nm $_numtok(32,%_prot.pre)
  384.       :Dummies
  385.       set %.var $gettok(%_prot.pre,%.nm,32) $+ %_prot.post $+ %_prot.chan
  386.       set % [ $+ [ %.var ] ]
  387.       if ($_vd(.nm) > 0) goto dummies
  388.       set %.var action*. $+ %_prot.post $+ %_prot.chan
  389.       [ unset % $+ [ %.var ] ]
  390.       window -c @Setting
  391.     }
  392.   }
  393.   if (%_prot.chan == $null) _pdispl $calc(%_prot.line - 3)
  394.   else _pdispl $calc(%_prot.line - 3) $_rchop(1,%_prot.chan)
  395. }
  396. _asetclk {
  397.   if ($sline(@Actions,1).ln < 3) return
  398.   set %.act $strip($gettok($sline(@Actions,1),1,32))
  399.   if (custom isin %.act) set %.act $_s2f($1-)
  400.   if (%.act == $null) _askr _asetclk Command to perform for action?
  401.   window -c @Actions
  402.   _psetclk %_prot.ln %.act
  403. }
  404. _rsetclk {
  405.   if ($sline(@Revolve,1).ln < 3) return
  406.   set %.ln $sline(@Revolve,1)
  407.   window -c @Revolve
  408.   _psetclk 3 $strip(%.ln)
  409. }
  410. _wsetclk {
  411.   set %.ln $sline(@WhoisOnJoin,1).ln
  412.   if (%.ln < 3) return
  413.   window -c @WhoisOnJoin
  414.   if (%.ln == 3) set %.ln Off
  415.   elseif (%.ln == 4) set %.ln Op
  416.   else set %.ln On
  417.   _peditl %_prot.whois %.ln
  418. }
  419. _lsetclk {
  420.   if ($1 < 3) return
  421.   set %.it $line(@ListSetting,$1)
  422.   if ($2 == $null) {
  423.     set %_arhelp _lsetclk $1
  424.     if ($1 == $line(@ListSetting,0)) _askr _arhelp New entry to add? (wildcards are ok)
  425.     else _pentry _arhelp $+ $line(@ListSetting,$1) New entry? (wildcards are ok)
  426.   }
  427.   if ($1 == $line(@ListSetting,0)) {
  428.     if ($2 == $chr(160)) return
  429.     iline @ListSetting $1 $2
  430.     if (%_prot.value == $null) set %_prot.value $2
  431.     else set %_prot.value %_prot.value $2
  432.   }
  433.   else {
  434.     if ($2 == $chr(160)) {
  435.       dline @ListSetting $1
  436.       set %_prot.value $remtok(%_prot.value,%.it,32)
  437.     }
  438.     else {
  439.       rline @ListSetting $1 $2
  440.       set %_prot.value $reptok(%_prot.value,%.it,$2,32)
  441.     }
  442.   }
  443.   _psetclk 2 ! %_prot.value
  444. }
  445. ; -----------------------------------------------------
  446. ; Standard configuration editor
  447. ; -----------------------------------------------------
  448. config if ($1 == $null) _config topics | else _config $1-
  449. _config {
  450.   if ($1 == ?) set %_c.sft $2 | else set %_c.sft *
  451.   if ($1 == msg) { set %_condef1 Basic default | set %_condef2 Fancy default }
  452.   else { set %_condef1 Default | unset %_condef2 }
  453.   window -c @Config
  454.   set %_c.line1 $left(%=,35) $+ 
  455.   set %_c.line2 $right(%=,35)
  456.   if ( isin %_c.line2) set %_c.line2  $+ $gettok(%_c.line2,2-,3)
  457.   window -l @Config $_winpos(3%,3%,1%,1%) @Config %font.basic
  458.   set %_c.file $_ppdir $+ configs.ini
  459.   titlebar @Config - $readini -n %_c.file $1 is
  460.   aline @Config (double-click to select/edit, right-click for default)
  461.   set %.c.num $readini -n %_c.file $1 num
  462.   set %.c.cur 1
  463.   :loop
  464.   set %.c.add $readini -n %_c.file $1 %.c.cur
  465.   set %.c.add $replace(%.c.add,*,%_c.sft)
  466.   aline @Config $_condisp(%.c.add)
  467.   if ($_vi(.c.cur) <= %.c.num) goto loop
  468.   set %_c.topic $1
  469.   if (($2 != $null) && ($1 != ?)) _consel $2
  470.   window -b @Config
  471. }
  472. _condisp {
  473.   if (($1 == ?S) || ($1 == ?Z) || ($1 == ?X)) return $3- - %col.target $+ $_conval($2)
  474.   set %.x.bit $left($1,1)
  475.   if (%.x.bit == -) { if ($3 == -) return %= | return %_c.line1 %col.dark $+ $3- $+  %_c.line2 }
  476.   set %.x.ret $3- - $remove(%col.target,) $+ 
  477.   if ($1 == ?F) {
  478.     if (%max.ver == 1) return %.x.ret $+ Tight CTCP flood protection
  479.     if (%max.ver == 2) return %.x.ret $+ Normal CTCP flood protection
  480.     if (%max.ver <= 4) return %.x.ret $+ Low CTCP flood protection
  481.     return %.x.ret $+ No CTCP flood protection
  482.   }
  483.   if (%.x.bit isin ?M) return > $3- <
  484.   if (%.x.bit isin YN) {
  485.     if ($_conval($2)) return %.x.ret $+ $remove(%col.info1,) $+ Yes
  486.     return %.x.ret $+ $remove(%col.att,) $+ No
  487.   }
  488.   if (%.x.bit == O) {
  489.     if ($_conval($2)) return %.x.ret $+ $remove(%col.info1,) $+ On
  490.     return %.x.ret $+ $remove(%col.att,) $+ Off
  491.   }
  492.   if ((%.x.bit == T) || (%.x.bit isnum)) {
  493.     set %.x.val $_conval($2)
  494.     if ((%.x.val == $null) || (%.x.val == 0)) return %.x.ret $+ $remove(%col.att,) $+ %.x.val
  495.     return %.x.ret $+ %.x.val
  496.   }
  497.   if (%.x.bit == L) return %.x.ret $+ $readini -n %_c.file $2 $_iniprep($_conval($2))
  498.   if (%.x.bit == K) {
  499.     set %.x.val $_conval($2)
  500.     return %.x.ret $+  $+ %.x.val $+ $_col2text(%.x.val)
  501.   }
  502.   if (%.x.bit == Z) {
  503.     set %.x.val $_conval($2)
  504.     if ($left(%.x.val,8) == !Random:) return %.x.ret $+ Random selection from file: $gettok(%.x.val,2-,58)
  505.     return $3- $remove(%col.target,) $+ -> %.x.val
  506.   }
  507.   return %.x.ret $+ $readini -n %_c.file dcc $_iniprep($_conval($2))
  508. }
  509. _conval {
  510.   if ($1 == ?) return $replace(%soundfile.custom,$chr(32),;)
  511.   set %.cv.bit $left($1,1)
  512.   if (%.cv.bit == $chr(35)) return $_o2tf($group($1))
  513.   elseif (%.cv.bit == [) return $_ppcfg($remove($gettok($1,1,93),[),$gettok($1,2,93))
  514.   elseif (%.cv.bit == !) return $_maprev($_rchop(1,$1))
  515.   else return % [ $+ [ $1 ] ]
  516. }
  517. _conset {
  518.   if ($1 == ?) return
  519.   set %.cv.bit $left($1,1)
  520.   if (%.cv.bit == $chr(35)) {
  521.     if ($2) .enable $1
  522.     else .disable $1
  523.   }
  524.   elseif (%.cv.bit == [) _writecfg $remove($gettok($1,1,93),[) $gettok($1,2,93) $2-
  525.   elseif (%.cv.bit == !) return
  526.   else set % [ $+ [ $1 ] ] $2-
  527.   if ($1 == [Sound]LeechCmd) {
  528.     set %leech.cmd.mask $_ppcfg(Sound,LeechCmd) *
  529.     if (%leech.cmd.mask == *) unset %leech.cmd.mask
  530.   }
  531.   elseif (($1 == +pager.here) && (%_away.why == $null)) set %+pager %+pager.here
  532. }
  533. _consel {
  534.   if ($1 < 3) return
  535.   set %.c.sel $readini -n %_c.file %_c.topic $_j($1)
  536.   set %.c.sel $replace(%.c.sel,*,%_c.sft)
  537.   set %.c.1 $gettok(%.c.sel,1,32)
  538.   if (%.c.1 == ?C) { window -c @Config | ctcpedit | halt }
  539.   if (%.c.1 == ?O) { window -c @Config | colors | halt }
  540.   if (%.c.1 == ?H) { window -c @Config | schemes | halt }
  541.   if (%.c.1 == ?V) { window -c @Config | fonts | halt }
  542.   if (%.c.1 == ?D) { window -c @Config | elements | halt }
  543.   set %.c.2 $gettok(%.c.sel,2,32)
  544.   set %.c.bit $left(%.c.1,1)
  545.   if (%.c.bit == -) return
  546.   if (%.c.bit == M) { _config %.c.2 | return }
  547.   if (%.c.bit isin YNO) {
  548.     if ($2 == ) _conset %.c.2 $_o2tf(%.c.1)
  549.     elseif ($_conval(%.c.2)) _conset %.c.2 $false
  550.     else _conset %.c.2 $true
  551.   }
  552.   elseif ($2 == ) {
  553.     if (%.c.bit isin TDK) _conset %.c.2 $_rchop(1,%.c.1)
  554.     elseif (%.c.bit isnum) _conset %.c.2 %.c.1
  555.     elseif (%.c.1 == Z) {
  556.       if ($3 == f) _conset %.c.2 $_ppdef2($remove($gettok(%.c.2,1,93),[),$gettok(%.c.2,2,93))
  557.       else _conset %.c.2 $_ppdef($remove($gettok(%.c.2,1,93),[),$gettok(%.c.2,2,93))
  558.     }
  559.     elseif ((%.c.1 == ?S) || (%.c.1 == ?Z) || (%.c.1 == ?X)) _conset %.c.2
  560.     elseif (%.c.1 == ?F) _setfld 20 5 8 40 2 5 30 3 5 15 0 6 40 2 4 15 6 18 8 11 15 250 450 on 350 30 3 0
  561.     else { set %.c.def $readini -n %_c.file %.c.2 def | _conset %.c.2 $readini -n %_c.file %.c.2 %.c.def }
  562.   }
  563.   else {
  564.     if (((%.c.bit == T) && ($2 == $null)) || ((%.c.bit isnum) && ($2 !isnum))) {
  565.       set %_arhelp _consel $1
  566.       _pentry _arhelp $+ $_s2p($_conval(%.c.2)) $gettok(%.c.sel,3-,32)
  567.     }
  568.     if (%.c.1 == ?S) {
  569.       set %.c.qu " $+ $gettok(%.c.sel,3-,32) $+ "
  570.       if (sound isin %.c.qu) set %.c.dir $wavedir $+ *.wav
  571.       else set %.c.dir c:\*.exe
  572.       _timer924off
  573.       set %.c.got $dir= [ $+ [ %.c.qu ] ] %.c.dir
  574.       _timer924on
  575.       if ((%.c.got == $null) || (* isin %.c.got)) return
  576.       _conset %.c.2 $remove(%.c.got,$mircdir)
  577.     }
  578.     elseif (%.c.1 == ?F) {
  579.       if ($2 == $null) {
  580.         window -c @Option
  581.         window -l @Option $_winpos(20%,20%,23%,23%) @Option %font.basic
  582.         titlebar @Option - $gettok(%.c.sel,3-,32)
  583.         aline @Option (double-click to select)
  584.         aline @Option %=
  585.         aline @Option Tight CTCP flood protection
  586.         aline @Option Normal CTCP flood protection
  587.         aline @Option Low CTCP flood protection
  588.         aline @Option No CTCP flood protection
  589.         set %_c.optsel _consel $1
  590.         set %_c.optcat color
  591.         halt
  592.       }
  593.       if ($2 == 1) _setfld 20 3 6 40 1 4 30 2 5 20 0 5 40 0 4 20 5 40 5 10 20 200 450 on 300 25 2 0
  594.       elseif ($2 == 2) _setfld 20 5 8 40 2 5 30 3 5 15 0 6 40 2 4 15 6 18 8 11 15 250 450 on 350 30 3 0
  595.       elseif ($2 == 3) _setfld 10 6 8 20 4 6 15 4 6 10 0 6 20 2 4 10 6 15 9 11 12 350 600 on 400 35 5 0
  596.       else _setfld 1 99 99 1 99 99 1 99 99 1 0 99 1 99 99 1 99 1 99 99 1 9999 9999 off 0 0 0 0
  597.     }
  598.     elseif ((%.c.1 == ?Z) || (%.c.1 == ?X)) {
  599.       if ($2 == $null) {
  600.         window -c @SoundDirs
  601.         window -l @SoundDirs $_winpos(19%,19%,20%,20%) @SoundDirs %font.basic
  602.         if (%.c.2 == ?) { set %_c.optsel ? | aline @SoundDirs - Double-click to modify options for a type, right-click to delete an entry - }
  603.         elseif (! isin %.c.2) { set %_c.optsel ! | aline @SoundDirs - Double-click to modify extension, right-click to delete an extension - }
  604.         else { set %_c.optsel _consel $1 | aline @SoundDirs - Double-click to modify a directory, right-click to delete an entry - }
  605.         set %_c.val $_conval(%.c.2)
  606.         aline @SoundDirs $chr(160)
  607.         set %.nm $_numtok(59,%_c.val)
  608.         if (%.nm > 0) {
  609.           set %.cr 1
  610.           :leep
  611.           aline @SoundDirs $gettok(%_c.val,%.cr,59)
  612.           if ($_vi(.cr) <= %.nm) goto leep
  613.         }
  614.         aline @SoundDirs (addánewáentry)
  615.         halt
  616.       }
  617.       _conset %.c.2 $2-
  618.     }
  619.     elseif (%.c.bit == Z) {
  620.       if ($2 == $null) {
  621.         window -c @Option
  622.         window -l @Option $_winpos(20%,20%,23%,23%) @Option %font.basic
  623.         titlebar @Option - $gettok(%.c.sel,3-,32)
  624.         aline @Option (double-click to select)
  625.         aline @Option %=
  626.         aline @Option Enter new message
  627.         aline @Option Use file for random messages
  628.         aline @Option Use default message
  629.         set %_c.optsel _consel $1
  630.         set %_c.optcat color
  631.         halt
  632.       }
  633.       if ($2 == 1) {
  634.         if ($3 == $null) {
  635.           set %.c.v $_conval(%.c.2)
  636.           set %_arhelp _consel $1 1
  637.           if ($left(%.c.v,8) == !Random:) _askr _arhelp New message to use? (see help for usage of &codes&)
  638.           else _pentry _arhelp $+ $_s2p($replace(%.c.v,,ü)) New message to use? (see help for usage of &codes&)
  639.         }
  640.         else set %.c.new $3-
  641.       }
  642.       elseif ($2 == 2) {
  643.         _timer924off
  644.         set %.c.got $dir="File to select random replies from?" [ [ $mircdir ] $+ ] *.txt
  645.         _timer924on
  646.         if ((%.c.got == $null) || (* isin %.c.got)) return
  647.         set %.c.new !Random: $+ $remove(%.c.got,$mircdir)
  648.       }
  649.       elseif ($2 == 3) set %.c.new $_ppdef($remove($gettok(%.c.2,1,93),[),$gettok(%.c.2,2,93))
  650.       _conset %.c.2 %.c.new
  651.     }
  652.     elseif ((%.c.bit isin DLK) && ($2 == $null)) {
  653.       if (%.c.bit == D) set %.c.2 dcc
  654.       window -c @Option
  655.       window -l @Option $_winpos(20%,20%,23%,23%) @Option %font.basic
  656.       titlebar @Option - $gettok(%.c.sel,3-,32)
  657.       aline @Option (double-click to select)
  658.       aline @Option %=
  659.       if (%.c.bit == K) set %.c.max 16
  660.       else set %.c.max $readini -n %_c.file %.c.2 num
  661.       set %.c.num 1
  662.       :loop
  663.       if (%.c.bit == K) aline @Option  $+ %.c.num $+ $_col2text(%.c.num)
  664.       else {
  665.         set %.c.opt $readini -n %_c.file %.c.2 %.c.num
  666.         aline @Option $readini -n %_c.file %.c.2 $_iniprep(%.c.opt)
  667.       }
  668.       if ($_vi(.c.num) <= %.c.max) goto loop
  669.       set %_c.optsel _consel $1
  670.       if (%.c.bit == K) set %_c.optcat color
  671.       else set %_c.optcat %.c.2
  672.       halt
  673.     }
  674.     else _conset %.c.2 $2-
  675.   }
  676.   rline @Config $1 $_condisp(%.c.sel)
  677. }
  678. _conopt if ($1 < 3) return | window -c @Option | if (%_c.optcat == color) %_c.optsel $calc($1 - 2) | else %_c.optsel $readini -n %_c.file %_c.optcat $calc($1 - 2)
  679. _sdirclk {
  680.   if ($1 < 3) return
  681.   set %_sndchange y
  682.   set %.it $line(@SoundDirs,$1)
  683.   set %_arhelp _sdirclk $1
  684.   if (%_c.optsel == !) {
  685.     if ($1 == $line(@SoundDirs,0)) {
  686.       if ($2 == $null) _askr _arhelp New file extension?
  687.       iline @SoundDirs $1 $remove($2,.)
  688.       set %soundfile.extmap1 %soundfile.extmap1 $remove($2,.)
  689.       set %soundfile.extmap2 %soundfile.extmap2 $line(@SoundDirs,3)
  690.     }
  691.     elseif ($1 == 3) _error You cannot delete or modify the main (first) extension as it is used to define the sound file type
  692.     elseif ($2 == $chr(160)) {
  693.       dline @SoundDirs $1
  694.       set %.pos $findtok(%soundfile.extmap1,%.it,32)
  695.       set %.egg $_numtok(32,%soundfile.extmap1)
  696.       unset %.toget2
  697.       if (%.pos == 1) set %.toget1 2-
  698.       elseif (%.pos == %.egg) set %.toget1 1- $+ $_j(%.egg)
  699.       else { set %.toget1 1- $+ $_j(%.pos) | set %.toget2 $_i(%.pos) $+ - $+ %.egg }
  700.       if (%.toget2 == $null) {
  701.         set %soundfile.extmap1 $gettok(%soundfile.extmap1,%.toget1,32)
  702.         set %soundfile.extmap2 $gettok(%soundfile.extmap2,%.toget1,32)
  703.       }
  704.       else {
  705.         set %soundfile.extmap1 $gettok(%soundfile.extmap1,%.toget1,32) $gettok(%soundfile.extmap1,%.toget2,32)
  706.         set %soundfile.extmap2 $gettok(%soundfile.extmap2,%.toget1,32) $gettok(%soundfile.extmap2,%.toget2,32)
  707.       }
  708.     }
  709.     else {
  710.       if ($2 == $null) _pentry _arhelp $+ %.it New file extension?
  711.       rline @SoundDirs $1 $2
  712.       set %soundfile.extmap1 $reptok(%soundfile.extmap1,%.it,$2,32)
  713.     }
  714.     return
  715.   }
  716.   elseif (%_c.optsel == ?) {
  717.     if ($1 == $line(@SoundDirs,0)) {
  718.       if ($2 == $null) _askr _arhelp File extension of new type? (Just one- you can add more file extensions later)
  719.       iline @SoundDirs $1 $remove($2,.)
  720.       set %soundfile.custom %soundfile.custom $remove($2,.)
  721.     }
  722.     elseif ($2 == $chr(160)) {
  723.       dline @SoundDirs $1
  724.       set %soundfile.custom $remtok(%soundfile.custom,%.it,32)
  725.     }
  726.     else { window -c @SoundDirs | config ? %.it }
  727.     return
  728.   }
  729.   if ($2 == $chr(160)) set %.dir $2
  730.   else {
  731.     if ($1 == $line(@SoundDirs,0)) set %.dir c:\
  732.     else { set %.dir $line(@SoundDirs,$1) | if ($right(%.dir,1) != \) set %.dir %.dir $+ \ }
  733.     _timer924off
  734.     set %.dir $sdir="Select a directory:" [ %.dir ]
  735.     if ((%.dir == $null) || (* isin %.dir)) return
  736.   }
  737.   if ($1 == $line(@SoundDirs,0)) {
  738.     if ($2 == $chr(160)) return
  739.     iline @SoundDirs $1 %.dir
  740.     if (%_c.val == $null) set %_c.val %.dir
  741.     else set %_c.val %_c.val $+ ; $+ %.dir
  742.   }
  743.   else {
  744.     if ($2 == $chr(160)) {
  745.       dline @SoundDirs $1
  746.       set %_c.val $remtok(%_c.val,%.it,59)
  747.       if (%_c.val == $null) set %_c.val $chr(127)
  748.     }
  749.     else {
  750.       rline @SoundDirs $1 %.dir
  751.       set %_c.val $reptok(%_c.val ,%.it,%.dir,59)
  752.     }
  753.   }
  754.   %_c.optsel %_c.val
  755. }
  756.